home *** CD-ROM | disk | FTP | other *** search
- To add a new command you must add a definition in function initexternals
- in external.c. Add an entry in arrays ext_name and ext_func. The former is
- the command name ("do xxx"), the later a pointer to the function that will
- be called. Keep in mind that the last element of the vector ext_name must
- be a NULL pointer. Next write in inject.c the function that performs your
- job (put its prototype in inject.h). Use terminal I/O from conio.h to
- keep windowing working. In the routine you can define the variable hookfunc
- to point to a function supplied by you, which will be called (if ishooked
- is equal to 1!) every times a packet arrives. It gets 3 parameters: an
- unsigned char * to the raw received packet, an int with the packet
- length and a struct netpacket * to a decoded version of the packet. Look
- in nettool.h for the explanation of the fileds in this struct. Have
- a look in inject.c at the examples before you write your routines.
-
- Good Job!
-
- Useful functions already present that you can use in your own new
- functions:
-
- getvar(char * name)
- Returns the value of the variable "name".
-
- setvar(char * name, char * value)
- Sets the value of the variable "name" to the input given as "value".
-
- delvar(char * name)
- Deletes the variable specified by the "name".
-
- in_cksum(unsigned char * addr, unsigned len)
- Returns the checksum of the buffer "addr" of lenght "len".
-
- putipchecksum(unsigned char * packet, unsigned len)
- Put the IP checksum and, if applicable, the TCP and UDP checksum to
- the packet "packet" of lenght "len".
-
- dopkt(char * what, int hm)
- Sends the packet "what" of lenght "hm". It also fills the "ethernet
- from" and "ethernet to" fields if respectively "fillethfrom" and
- "fillethto" variables are set.
-
-
-